---
title: Hono
description: API Authentication in Hono
mode: "wide"
---

## Prerequisites

- Created your [Unkey account](https://app.unkey.com/auth/sign-up)
- Created an API in the [Unkey dashboard](https://app.unkey.com/apis)

<Card title="Skip the tutorial" icon="link" href="https://github.com/unkeyed/examples/tree/main/hono">
  Don't want to read the tutorial? Click this to get an example ready to test.
</Card>

<Steps titleSize="h3">

<Step title="Create Hono Application">
Run the following command to create your Hono project

<CodeGroup>

```bash npm
npm create hono@latest
```

```bash pnpm
pnpm create hono@latest
```

```bash yarn
yarn create hono@latest
```

```bash bun
bun create hono@latest
```

</CodeGroup>

</Step>
<Step  title="Install">

Now install the `@unkey/hono` package

<CodeGroup>

```bash npm
npm install @unkey/hono
```

```bash pnpm
pnpm add @unkey/hono
```

```bash yarn
yarn add @unkey/hono
```

```bash bun
bun install @unkey/hono
```

</CodeGroup>

</Step>

<Step title="Update index to use our Hono SDK">

Create a new route and add the following code

```ts /src/index.ts
import { Hono } from "hono";
import { unkey, UnkeyContext } from "@unkey/hono";

const app = new Hono<{ Variables: { unkey: UnkeyContext } }>();

app.use("*", unkey());

app.get("/", (c) => {
	return c.text("Hello Hono!");
});

export default app;
```

</Step>

<Step title="Running it">

<CodeGroup>

```bash npm
npm run dev
```

```bash pnpm
pnpm run dev
```

```bash yarn
yarn run dev
```

```bash bun
bun run dev
```

</CodeGroup>

</Step>

<Step  title="Try it out">

Go to https://app.unkey.com and create a new key. Then verify it with our new server:

```bash
curl -XPOST 'http://localhost:8787/' \
  -H "Authorization: Bearer <KEY>"
```

It should return `Hello Hono!"`

</Step>

</Steps>

## What is next?

Now that you've seen the power of Unkey, check out some resources below to continue your journey.

<CardGroup cols={3}>
  <Card title="Discord" icon="discord" href="https://unkey.com/discord">Join our Discord to chat with us and the community</Card>
  <Card title="Unkey API Reference" icon="database" href="/api-reference">
     Learn about our API that helps you manage APIs, keys, ratelimits and analytical data.
  </Card>
  <Card title="Hono SDK" icon="brackets-curly" href="/libraries/ts/hono">
   Check out our Hono SDK and how they fit into your API.
  </Card>
</CardGroup>
